package com.example.notificationandnotificationmanager;

import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class MainActivity2 extends AppCompatActivity {
private EditText etUser;
private EditText etpassword;
private Button btnlogin;
private Button btnReset;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main2);
        Log.e("leo", "onCreate: MainActivity2" );
        btnlogin = findViewById(R.id.btnlogin);
        findViewById(R.id.AAA);
        etUser = findViewById(R.id.etUser);
        etpassword = findViewById(R.id.etpassword);
        btnlogin.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                switch (v.getId()){
                    case R.id.btnlogin:
                        if (etUser.getText().toString().equals("admin")&
                                etpassword.getText().toString().equals("123456"))
                            new AlertDialog.Builder(MainActivity2.this)
                                    .setTitle("登录信息")
                                    .setMessage("登录成功")
                                    .setPositiveButton("确定",null)
                                    .create()
                                    .show();
                        if (etpassword.getText().toString().equals(123456));
                        Toast.makeText(MainActivity2.this,"密码错误",Toast.LENGTH_LONG).show();
            }
        };
        });
        btnReset.setOnClickListener(new View.OnClickListener() {
                                        @Override
                                        public void onClick(View v) {

                                        }
                                    }
        );
    }


}